import { generatorDynamicRouter } from '@/router/generator-routers';

export const actions = {
  async generateRoutes({ commit }) {
    // 动态获取菜单
    const routers = await generatorDynamicRouter();
    commit('setRouters', routers);
    return routers;
  },
  async generateActivityed({ commit, getters }) {
    let curActive = null;

    if (getters['curActive'] && getters['curActive'].hasOwnProperty('id')) {
      curActive = getters['curActive']
    } else {
      commit('setCurActive', curActive)
    }
    return curActive
  }
};
